#include "widget.h"
#include "ui_widget.h"
#include <QPushButton>
#include <QDebug>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    QPushButton* button = new QPushButton(this);
    button->setText("按钮");
    button->setEnabled(false);
    connect(button,&QPushButton::clicked,this,&Widget::handleClicked);

}

Widget::~Widget()
{
    delete ui;
}

void Widget::handleClicked()
{
    qDebug() << "执行槽函数";
}


void Widget::on_pushButton_clicked()
{
    //获取第一个按钮的可用状态
    bool enable = ui->pushButton_2->isEnabled();
    if(enable)
    {
        ui->pushButton_2->setEnabled(false);
    }
    else
    {
        ui->pushButton_2->setEnabled(true);
    }

}

void Widget::on_pushButton_2_clicked()
{
    qDebug() << "执行槽函数";
}
